package com.travel.recommend.service.impl;

import com.travel.recommend.entity.RecommendParameterEntity;
import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.travel.common.utils.PageUtils;
import com.travel.common.utils.Query;

import com.travel.recommend.dao.SimilarityConfigDao;
import com.travel.recommend.entity.SimilarityConfigEntity;
import com.travel.recommend.service.SimilarityConfigService;


@Service("similarityConfigService")
public class SimilarityConfigServiceImpl extends ServiceImpl<SimilarityConfigDao, SimilarityConfigEntity> implements SimilarityConfigService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        IPage<SimilarityConfigEntity> page = this.page(
                new Query<SimilarityConfigEntity>().getPage(params),
                new QueryWrapper<SimilarityConfigEntity>()
        );

        return new PageUtils(page);
    }

    /**
     * 获取当前使用的配置
     * @return
     */
    @Override
    public SimilarityConfigEntity getNowSimilarityConfig() {
        return this.baseMapper.selectOne(new QueryWrapper<SimilarityConfigEntity>().eq("now_config",1));

    }


}